using UnityEngine;
using System.Collections;

public class Caio : MonoBehaviour
{
    public int Id = 48;

    void Start()
    {
        this.gameObject.AddComponent("MeshRenderer");
        this.gameObject.AddComponent("MeshFilter");
        this.gameObject.AddComponent("BoxCollider");
        this.gameObject.AddComponent("Rigidbody");
        this.gameObject.GetComponent<Rigidbody>().useGravity = false;

        this.gameObject.GetComponent<BoxCollider>().size = new Vector3(0.2f, 0.2f, 0);
        Mesh mesh = Quad.Create(0.3f, 0.7f);

        this.transform.position = new Vector3(-0.8f, 0, -1);

        this.gameObject.GetComponent<MeshFilter>().mesh = mesh;
        this.gameObject.GetComponent<MeshRenderer>().material = AtlasManager.globalMaterial;

        this.gameObject.GetComponent<MeshFilter>().mesh.uv = new Vector2[]
		{
		    new Vector2(AtlasManager.rects[Id].xMin, AtlasManager.rects[Id].yMax),
			new Vector2(AtlasManager.rects[Id].xMax, AtlasManager.rects[Id].yMax),
			new Vector2(AtlasManager.rects[Id].xMax, AtlasManager.rects[Id].yMin),
			new Vector2(AtlasManager.rects[Id].xMin, AtlasManager.rects[Id].yMin)
		};
    }

    void Update()
    {
    }
}
